package com.dq.context.listener.user;

import com.dq.context.event.user.UserBindCardEvent;
import com.dq.utils.SmsUtils;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author liuhui
 * @date 2019/9/22 0022 13:33:29
 */
@Component
public class UserBindCardEventListener implements ApplicationListener<UserBindCardEvent> {


    @Override
    @Async
    public void onApplicationEvent(UserBindCardEvent event) {
        Map<String, String> map = (Map) event.getSource();
        // 发放验证短信/邮件/..
        SmsUtils.sendBindCardSms(map.get("phone"), map.get("smsCode"));
    }
}
